package org.jeecg.modules.platformMasterEndPoint.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.miniAppCustomerEndPoint.entity.JxSiteMenuDo;
import org.jeecg.modules.miniAppCustomerEndPoint.entity.JxSiteMenuVo;
import org.jeecg.modules.miniAppCustomerEndPoint.entity.JxSiteStoreDo;
import org.jeecg.modules.miniAppCustomerEndPoint.entity.JxSiteStoreVo;
import org.jeecg.modules.miniAppCustomerEndPoint.mapper.JxSiteMenuMapper;
import org.jeecg.modules.miniAppCustomerEndPoint.mapper.JxSiteStoreMapper;
import org.jeecg.modules.platformMasterEndPoint.entity.*;
import org.jeecg.modules.platformMasterEndPoint.enums.JxBusinessStateEnum;
import org.jeecg.modules.platformMasterEndPoint.mapper.JxFoodRepositoryMapper;
import org.jeecg.modules.platformMasterEndPoint.mapper.JxSiteDetailMapper;
import org.jeecg.modules.platformMasterEndPoint.mapper.JxSiteMasterManageMapper;
import org.jeecg.modules.platformMasterEndPoint.mapper.JxStoreRepositoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

@Api(tags = "站点管理")
@RestController
@RequestMapping("/jx/jxSiteManage")
@Slf4j
public class JxSiteManageController {


    @Autowired
    private JxSiteDetailMapper jxSiteDetailMapper;

    @Autowired
    private JxSiteStoreMapper jxSiteStoreMapper;

    @Autowired
    private JxStoreRepositoryMapper jxStoreRepositoryMapper;

    @Autowired
    private JxSiteMenuMapper jxSiteMenuMapper;

    @Autowired
    private JxSiteMasterManageMapper jxSiteMasterManageMapper;

    @Autowired
    private JxFoodRepositoryMapper jxFoodRepositoryMapper;

    @ApiOperation("创建一个新站点")
    @PostMapping("/addNewSite")
    public Result<?> createNewSite(@RequestBody()JxSiteDetailVo siteDetailVo){

        List<JxSiteDetailDo> list = jxSiteDetailMapper.selectList(new LambdaQueryWrapper<JxSiteDetailDo>()
                .eq(JxSiteDetailDo::getRegionName, siteDetailVo.getRegionName())
                .eq(JxSiteDetailDo::getSiteName, siteDetailVo.getSiteName()));

        if (list != null && list.size() > 0) {
            log.error("区域: {} 已经有名称为 {} 的站点，同一个区域不能创建同名的站点", siteDetailVo.getRegionName(), siteDetailVo.getSiteName());
            return Result.error("区域：" + siteDetailVo.getRegionName() + " 已经存在名称为 " + siteDetailVo.getSiteName() + " 的站点，同一个区域不能创建同名的站点");
        }

        JxSiteDetailDo siteDetailDo = new JxSiteDetailDo();
        siteDetailDo.setRegionId(siteDetailVo.getRegionId());
        siteDetailDo.setRegionName(siteDetailVo.getRegionName());
        siteDetailDo.setSiteName(siteDetailVo.getSiteName());
        siteDetailDo.setSiteMasterId(siteDetailVo.getSiteMasterId());
        siteDetailDo.setLongitude(siteDetailVo.getLongitude());
        siteDetailDo.setLatitude(siteDetailVo.getLatitude());
        siteDetailDo.setSupplyAddress(siteDetailVo.getSupplyAddress().toJSONString());
        siteDetailDo.setStorePrice(siteDetailVo.getStorePrice());
        siteDetailDo.setSiteMasterCommissionType(siteDetailVo.getSiteMasterCommissionType());
        siteDetailDo.setSiteMasterCommissionValue(siteDetailVo.getSiteMasterCommissionValue());
        siteDetailDo.setPlatFormCommissionType(siteDetailVo.getPlatFormCommissionType());
        siteDetailDo.setPlatFormCommissionValue(siteDetailVo.getPlatFormCommissionValue());
        siteDetailDo.setSalePrice(siteDetailVo.getSalePrice());
        siteDetailDo.setCreateTime(new Date());

        int count = jxSiteDetailMapper.insert(siteDetailDo);
        if (count == 1) {
            log.info("在区域: {} 中新建站点: {}，站点id: {}", siteDetailVo.getRegionName(), siteDetailVo.getSiteName(), siteDetailDo.getId());
            HashMap<String,String> resultData = new HashMap<>();
            resultData.put("siteId", siteDetailDo.getId());
            resultData.put("siteName", siteDetailDo.getSiteName());
            return Result.ok(resultData);
        } else {
            return Result.error("为区域: " + siteDetailVo.getRegionName() + " 添加站点: " + siteDetailVo.getSiteName() + "失败，联系后台技术人员进行处理");
        }
    }


    @ApiOperation("删除一个站点")
    @DeleteMapping("/deleteSiteById")
    public Result<?> deleteSiteById(@RequestParam("siteId") String siteId) {

        int count = jxSiteDetailMapper.deleteById(siteId);
        if (count == 1) {
            return Result.ok("删除站点 "+ siteId + " 成功");
        } else {
            return Result.error("删除站点 "+ siteId + " 失败，请联系后台技术人员处理");
        }
    }

    @ApiOperation("根据区域或关键字返回符合条件的站点列表")
    @GetMapping("/querySitesByRegionOrKeyword")
    public Result<?> querySitesByRegionOrKeyword(
            @RequestParam(value = "regionId", required = false, defaultValue = "") String regionId,
             @RequestParam(value = "keyword", required = false, defaultValue = "") String keyword,
            @RequestParam("pageNo") Integer pageNo,
            @RequestParam("pageSize") Integer pageSize) {

        LambdaQueryWrapper<JxSiteDetailDo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.like(JxSiteDetailDo::getRegionId, regionId).like(JxSiteDetailDo::getSiteName, keyword);
        Page<JxSiteDetailDo> page = new Page<>(pageNo, pageSize);
        Page<JxSiteDetailDo> pageList = jxSiteDetailMapper.selectPage(page, lambdaQueryWrapper);
        List<HashMap<String, Object>> formatedList = new ArrayList<>();

        for (int i = 0; i < pageList.getRecords().size(); i++) {
            JxSiteDetailDo siteDetailDo = pageList.getRecords().get(i);
            HashMap<String, Object> siteDetail = new HashMap<>();

            siteDetail.put("siteId", siteDetailDo.getId());
            siteDetail.put("siteName", siteDetailDo.getSiteName());
            siteDetail.put("regionId", siteDetailDo.getRegionId());
            siteDetail.put("regionName", siteDetailDo.getRegionName());
            siteDetail.put("siteMasterId", siteDetailDo.getSiteMasterId());
// todo 此处对每一个站点，都需要执行一次sql查询，效率很低；后续需要将站长信息缓存到redis中，每个站长使用一个key-value 对来保存站长信息，避免频繁对sql的查询
// kv结果类似： jx_site_master_xxxid -> {"name": "", "phone": ""}
            JxSiteMasterDo siteMasterDo = jxSiteMasterManageMapper.selectById(siteDetailDo.getSiteMasterId());
            String siteMasterName = siteMasterDo != null ? siteMasterDo.getName() : "未知";
            siteDetail.put("siteMasterName", siteMasterName);

//            siteDetail.put("longitude", siteDetailDo.getLongitude());
//            siteDetail.put("latitude", siteDetailDo.getLatitude());
            siteDetail.put("supplyAddress", JSONArray.parseArray(siteDetailDo.getSupplyAddress()));
            siteDetail.put("storePrice", siteDetailDo.getStorePrice());
            siteDetail.put("siteMasterCommissionType", siteDetailDo.getSiteMasterCommissionType());
            siteDetail.put("siteMasterCommissionValue", siteDetailDo.getSiteMasterCommissionValue());
            siteDetail.put("platFormCommissionType", siteDetailDo.getPlatFormCommissionType());
            siteDetail.put("platFormCommissionValue", siteDetailDo.getPlatFormCommissionValue());
            siteDetail.put("salePrice", siteDetailDo.getSalePrice());

            formatedList.add(siteDetail);
        }
        HashMap<String, Object> resultData = new HashMap<>();
        resultData.put("totalCount", pageList.getTotal());
        resultData.put("totalPages", pageList.getPages());
        resultData.put("currentPage", pageList.getCurrent());
        resultData.put("sites", formatedList);

        return Result.ok(resultData);
    }

    /**
     * 展示已经为站点挑选的店铺列表，如果是新站点，则返回空
     * 平台管理端 PPT10 页 表格中，点击【配置店铺】，跳转到 PPT17 页时，需要此接口提供 已经为站点配置的店铺以及店铺中的菜品，且菜品要按照 分类进行返回展示
     * @return
     */
    @ApiOperation("查询为某个站点配置的所以店铺及菜品信息")
    @GetMapping("/querySelectedStoresBySiteId")
    public Result<?> querySelectedStoresBySiteId(@RequestParam("siteId") String siteId) {

        List<JxSiteStoreDo> siteStores = jxSiteStoreMapper.selectList(new LambdaQueryWrapper<JxSiteStoreDo>().eq(JxSiteStoreDo::getSiteId, siteId));
        if (siteStores == null) {
            log.error("站点{} 没有配置店铺", siteId);
        }
        List<JSONObject> resultList = new ArrayList<>();
        for (int i = 0 ; i < siteStores.size() ; i ++) {
            JxSiteStoreDo siteStoreDo = siteStores.get(i);
            JxStoreRepositoryDo storeRepositoryDo = jxStoreRepositoryMapper.selectById(siteStoreDo.getStoreId());
            if (storeRepositoryDo == null) {
                log.error("无法从 店铺信息库 表中查找到id为 {} 的店铺信息，跳过此店铺", siteStoreDo.getStoreId());
                continue;
            }
            JSONObject formatedStore = new JSONObject();
            // 店铺公共信息，如下信息对各个站点都是一样的
            formatedStore.put("storeName", storeRepositoryDo.getStoreName());
            formatedStore.put("description", storeRepositoryDo.getStoreDescription());
            formatedStore.put("logo", storeRepositoryDo.getLogo());
            formatedStore.put("storePrice", storeRepositoryDo.getStorePrice());
            formatedStore.put("categoryId", storeRepositoryDo.getCategoryId());
            formatedStore.put("categoryName", storeRepositoryDo.getCategoryName());
            formatedStore.put("businessStart", storeRepositoryDo.getBusinessStart());
            formatedStore.put("businessEnd", storeRepositoryDo.getBusinessEnd());
            formatedStore.put("qualifications", storeRepositoryDo.getQualifications());

            // 店铺在某个站点的个性化的信息
            formatedStore.put("storeStatus", siteStoreDo.getStoreStatus().getName());
            formatedStore.put("packagingScore", siteStoreDo.getPackagingScore());
            formatedStore.put("componentScore", siteStoreDo.getComponentScore());
            formatedStore.put("flavorScore", siteStoreDo.getFlavorScore());
            formatedStore.put("sort", siteStoreDo.getSort());
            formatedStore.put("siteMasterCommissionType", siteStoreDo.getSiteMasterCommissionType());
            formatedStore.put("siteMasterCommissionValue", siteStoreDo.getSiteMasterCommissionValue());
            formatedStore.put("platFormCommissionType", siteStoreDo.getPlatFormCommissionType());
            formatedStore.put("platFormCommissionValue", siteStoreDo.getPlatFormCommissionValue());
            formatedStore.put("storePrice", siteStoreDo.getStorePrice());
            formatedStore.put("salePrice", siteStoreDo.getSalePrice());

            // 从站点菜单表中，查询出为该站点配置的菜品
            List<JxSiteMenuDo> siteMenu = jxSiteMenuMapper.selectList(new LambdaQueryWrapper<JxSiteMenuDo>()
                    .eq(JxSiteMenuDo::getSiteId, siteId)
                    .eq(JxSiteMenuDo::getStoreId, storeRepositoryDo.getId()));
            // key为 菜品类型，value为菜品 列表
            HashMap<String, List<JSONObject>> foods = new HashMap<>();
            for (int k = 0 ; k < siteMenu.size() ; k ++){
                JxSiteMenuDo siteMenuItem = siteMenu.get(k);
                JxFoodRepositoryDo foodRepositoryDo = jxFoodRepositoryMapper.selectById(siteMenuItem.getFoodId());
                if (foodRepositoryDo == null) {
                    log.error("无法从菜品信息库中查找到菜品id为 {} 的菜品", siteMenuItem.getFoodId());
                    continue;
                }

                if (!foods.containsKey(foodRepositoryDo.getFoodTypeName())) {
                    foods.put(foodRepositoryDo.getFoodTypeName(), new ArrayList<>());
                }

                JSONObject foodInfo = new JSONObject();
                foodInfo.put("foodId", siteMenuItem.getFoodId());
                foodInfo.put("foodName", foodRepositoryDo.getFoodName());
                foodInfo.put("foodImage", foodRepositoryDo.getImage());
                foodInfo.put("limitCount", siteMenuItem.getLimitCount());
                foodInfo.put("storePrice", siteMenuItem.getStorePrice());
                foodInfo.put("salePrice", siteMenuItem.getSalePrice());
                foodInfo.put("sort", siteMenuItem.getSort());
                foodInfo.put("siteMasterCommissionType", siteMenuItem.getSiteMasterCommissionType());
                foodInfo.put("siteMasterCommissionValue", siteMenuItem.getSiteMasterCommissionValue());
                foodInfo.put("platFormCommissionType", siteMenuItem.getPlatFormCommissionType());
                foodInfo.put("platFormCommissionValue", siteMenuItem.getPlatFormCommissionValue());
                foodInfo.put("specification", JSONArray.parse(foodRepositoryDo.getSpecification()));
                foods.get(foodRepositoryDo.getFoodTypeName()).add(foodInfo);
            }

            formatedStore.put("foods", foods);

            resultList.add(formatedStore);
        }
        return Result.ok(resultList);
    }


    /**
     * 有些下拉列表中，需要展示为某个店铺展示的店铺列表，此时只需要返回店铺id和店铺名称即可
     *
     * 接口使用场景
     * 1. 平台管理端，创建 优惠券 页面，需要挑选优惠券可以在那些店铺使用，店铺下拉列表中的数据，通过该接口获取；
     *
     * @return
     */
    @ApiOperation("查询为某个站点供餐的店铺简要信息列表")
    @GetMapping("/queryStoreBriefInfoBySiteId")
    public Result<?> queryStoreBriefInfoBySiteId(
            @RequestParam("siteId") String siteId,
            @RequestParam(value = "pageNo", required = false, defaultValue = "0") Integer pageNo,
            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {

        Page<JxSiteStoreDo> page = new Page<>(pageNo, pageSize);
        Page<JxSiteStoreDo> pageList = jxSiteStoreMapper.selectPage(page,
                new LambdaQueryWrapper<JxSiteStoreDo>().eq(JxSiteStoreDo::getSiteId, siteId)
                        .select(JxSiteStoreDo::getStoreId));

        List<JSONObject> formatedStores = new ArrayList<>();
        for (int k = 0 ; k < pageList.getRecords().size(); k ++) {
            JSONObject formatedStore = new JSONObject();
            String storeId = pageList.getRecords().get(k).getStoreId();
            formatedStore.put("storeId", storeId);

            JxStoreRepositoryDo storeRepositoryDo = jxStoreRepositoryMapper.selectById(storeId);
            if (storeRepositoryDo == null) {
                log.error("店铺信息库中，无法查找到店铺id为 {} 的店铺", storeId);
                continue;
            }
            formatedStore.put("storeName", storeRepositoryDo.getStoreName());

            formatedStores.add(formatedStore);
        }

        HashMap<String, Object> resultData = new HashMap<>();
        resultData.put("totalCount", pageList.getTotal());
        resultData.put("totalPages", pageList.getPages());
        resultData.put("currentPage", pageList.getCurrent());
        resultData.put("stores", formatedStores);

        return Result.ok(resultData);
    }

    /**
     * 为站点添加店铺，可以一次添加一个或多个店铺，传递的参数格式为
     * [
     * ["store_id_1111", "华南小碗菜-南油"],
     * ["store_id_1112", "华南小碗菜-福田"]
     * ]
     * @return
     */
    @ApiOperation("为站点大厦挑选店铺")
    @PostMapping("/addStoresForSite")
    public Result<?> addStoreForSite(@RequestBody() JxSiteStoreVo siteStoreVo) {

        List<JxSiteStoreDo> list = jxSiteStoreMapper.selectList(
                new LambdaQueryWrapper<JxSiteStoreDo>()
                        .eq(JxSiteStoreDo::getSiteId, siteStoreVo.getSiteId())
                        .eq(JxSiteStoreDo::getStoreId, siteStoreVo.getStoreId()));
        if (list != null && list.size() > 0) {
            log.error("已经为站点: {} 配置了店铺: {} , 请求联系后台技术人员排查问题" , siteStoreVo.getSiteId(), siteStoreVo.getStoreId());
            return Result.error(450, "已经为站点: " + siteStoreVo.getSiteId() + " 配置了店铺: " + siteStoreVo.getStoreId() + "， 请求联系后台技术人员排查问题");
        }

        JxSiteStoreDo siteStoreDo = new JxSiteStoreDo();
        siteStoreDo.setSiteId(siteStoreVo.getSiteId());
        siteStoreDo.setStoreId(siteStoreVo.getStoreId());
        // jx_site_address_store 表中，下面几列都可以不要，直接通过 store_id 关联到 jx_store_repository 表即可
        siteStoreDo.setPackagingScore(5.0);
        siteStoreDo.setComponentScore(5.0);
        siteStoreDo.setFlavorScore(5.0);
        siteStoreDo.setStoreSaleCount(0L);
        siteStoreDo.setStoreStatus(JxBusinessStateEnum.YES);
        siteStoreDo.setSort(siteStoreVo.getSort());
        siteStoreDo.setSiteMasterCommissionType(siteStoreVo.getSiteMasterCommissionType());
        siteStoreDo.setSiteMasterCommissionValue(siteStoreVo.getSiteMasterCommissionValue());
        siteStoreDo.setPlatFormCommissionType(siteStoreVo.getPlatFormCommissionType());
        siteStoreDo.setPlatFormCommissionValue(siteStoreVo.getPlatFormCommissionValue());
        siteStoreDo.setStorePrice(siteStoreVo.getStorePrice());
        siteStoreDo.setSalePrice(siteStoreVo.getSalePrice());

        siteStoreDo.setDelFlag(0);
        siteStoreDo.setCreateTime(new Date());
        siteStoreDo.setUpdateTime(new Date());

        int count = jxSiteStoreMapper.insert(siteStoreDo);
        if (count == 1) {
            log.info("为站点 {} 配置一个新店铺 {} 成功", siteStoreVo.getSiteId(), siteStoreVo.getStoreId());
            return Result.ok();
        } else {
            return Result.error("为站点添加供餐店铺失败，联系后台技术人员进行处理");
        }
    }


    /**
     * 接口使用场景
     * 1. 为站点配置菜品时，点击 【挑选菜品】 按钮，弹出窗口中
     * @return
     */
    @GetMapping("/querySelectedFoodsDetail")
    public Result<?> querySelectedFoodsDetail() {

        return null;
    }

    /**
     * 点击【挑选菜品】按钮，弹出弹窗中，勾选表格中的一个或多个菜品后，调用此接口，将勾选的菜品配置给该站点
     * 可以一次添加一个或多个菜品，传递的参数格式为
     * [
     * ["food_id_1111", "菜品1", "抽佣1",16.9, 10],  销售价16.9，限购10份
     * ["food_id_1112", "菜品2", "抽佣1", 18.9, 10]  销售价18.9，限购10份
     * ]
     * @param siteMenuFood
     * @return
     */
    @ApiOperation("为站点大厦挑选菜品")
    @PostMapping("/addFoodsForSite")
    public Result<?> addFoodsForSite(@RequestBody() JxSiteMenuVo siteMenuFood) {

        JxSiteMenuDo siteMenuDo = new JxSiteMenuDo();
        siteMenuDo.setSiteId(siteMenuFood.getSiteId());
        siteMenuDo.setFoodId(siteMenuFood.getFoodId());
        siteMenuDo.setStoreId(siteMenuFood.getStoreId());
        siteMenuDo.setLimitCount(siteMenuFood.getLimitCount());
        siteMenuDo.setSalePrice(siteMenuFood.getSalePrice());
        siteMenuDo.setStorePrice(siteMenuFood.getStorePrice());
        siteMenuDo.setSiteMasterCommissionType(siteMenuFood.getSiteMasterCommissionType());
        siteMenuDo.setSiteMasterCommissionValue(siteMenuFood.getSiteMasterCommissionValue());
        siteMenuDo.setPlatFormCommissionType(siteMenuFood.getPlatFormCommissionType());
        siteMenuDo.setPlatFormCommissionValue(siteMenuFood.getPlatFormCommissionValue());
        siteMenuDo.setSort(siteMenuFood.getSort());
        siteMenuDo.setDelFlag(0);
        siteMenuDo.setCreateTime(new Date());
        siteMenuDo.setUpdateTime(new Date());

        int count = jxSiteMenuMapper.insert(siteMenuDo);
        if (count == 1) {
            log.info("为站点 {} 配置一个新菜品 {} 成功", siteMenuFood.getSiteId(), siteMenuFood.getFoodName());
            return Result.ok();
        } else {
            return Result.error("为站点添加菜品失败，联系后台技术人员进行处理");
        }
    }

    @ApiOperation("展示可以为某个站点供餐的店铺列表")
    @GetMapping("/queryCanSupplyStores")
    public Result<?> queryCanSupplyStoresBySiteId(@RequestParam("siteId") String siteId) {

        List<JxStoreRepositoryDo> list = jxStoreRepositoryMapper.queryCanSupplyStoresBySiteId(siteId);
        List<JSONObject> formatedSiteStores = new ArrayList<>();
        for (int i = 0 ; i < list.size(); i ++) {
            JxStoreRepositoryDo siteStoreDo = list.get(i);
            JSONObject storeInfo = new JSONObject();
            storeInfo.put("storeId", siteStoreDo.getId());
            JxStoreRepositoryDo storeRepositoryDo = jxStoreRepositoryMapper.selectById(siteStoreDo.getId());
            if (storeRepositoryDo == null) {
                log.error("店铺信息库中找不到店铺id为 {} 的记录，请联系后台技术人员进行分析", siteStoreDo.getId());
                continue;
            }

            // 店铺的公共信息，店铺的如下信息，对所以站点而言，都所以一样的
            storeInfo.put("storeId", storeRepositoryDo.getId());
            storeInfo.put("storeName", storeRepositoryDo.getStoreName());
            storeInfo.put("description", storeRepositoryDo.getStoreDescription());
            storeInfo.put("logo", storeRepositoryDo.getLogo());
            storeInfo.put("storePrice", storeRepositoryDo.getStorePrice());
            storeInfo.put("categoryId", storeRepositoryDo.getCategoryId());
            storeInfo.put("categoryName", storeRepositoryDo.getCategoryName());
            storeInfo.put("qualifications", storeRepositoryDo.getQualifications());
            storeInfo.put("businessStart", storeRepositoryDo.getBusinessStart());
            storeInfo.put("businessEnd", storeRepositoryDo.getBusinessEnd());
            storeInfo.put("merchantName", storeRepositoryDo.getMerchantName());
            storeInfo.put("merchantIdNum", storeRepositoryDo.getMerchantIdNum());
            // 如下信息从站点信息中继承而来，店铺针对各个站点不一样的信息，店铺的如下信息，在不同的站点，值不一样
            JxSiteDetailDo siteDetailDo = jxSiteDetailMapper.selectById(siteId);
            if (siteDetailDo == null) {
                return Result.error("无法从站点信息表中查询到id为 "+ siteId +" 的站点信息，请联系后台技术人员进行处理");
            }
            storeInfo.put("siteMasterCommissionType", siteDetailDo.getSiteMasterCommissionType());
            storeInfo.put("siteMasterCommissionValue", siteDetailDo.getSiteMasterCommissionValue());
            storeInfo.put("platFormCommissionType", siteDetailDo.getPlatFormCommissionType());
            storeInfo.put("platFormCommissionValue", siteDetailDo.getPlatFormCommissionValue());
            storeInfo.put("storePrice", siteStoreDo.getStorePrice());
            storeInfo.put("salePrice", siteDetailDo.getSalePrice());

            formatedSiteStores.add(storeInfo);
        }

        return Result.ok(formatedSiteStores);
    }
}
